<!--{if $explorer_setting['left_topcontent']}-->
<ul class="nav-drawer nav-stacked nav-pills">
  <li class="nav-item">
    <a href="javascript:;" class="nav-link active document-data" data-href="{MOD_URL}&op=recent" data-hash="recent"><i class="mdi mdi-clock-time-four"></i><span>{lang recently_used}</span></a>
  </li>
  <li class="dropdown-divider"></li>
  <li><span class="dropdown-item disabled">{lang position}</span></li>
</ul>
<div class="positionMenu"><div id="position" class="mechsnismMenu list-unstyled" style="padding:5px 0"></div>
</div>
<!--{/if}-->
<ul class="nav-drawer nav-stacked nav-pills typeaMenu">
  <li class="dropdown-divider"></li>
  <li>
    <span class="dropdown-item disabled">{lang type}</span>
    <!--{if $explorer_setting['allownewcat']}-->
    <button type="button" class="groupbutton dcolor" onclick="showWindow('addsearchcat','{MOD_URL}&op=ajax&operation=addsearchcat','get',0)" ><span class="mdi mdi-plus-circle"></span></button>
    <!--{/if}-->
</li>
  <!--{loop $catsearch $v}-->
  <li class="nav-item">
    <a href="javascript:;" class="nav-link document-data" data-href="{MOD_URL}&op=catsearch" id="searchcat_{$v[id]}" data-hash="catsearch&do=searchfile&id=$v[id]" data-args="do_searchfile-id_{$v[id]}"> 
      <!--{if $v[catname] == lang('pictures')}--> 
      <i class="mdi mdi-file-image"></i> 
      <!--{elseif $v[catname] == lang('document')}--> 
      <i class="mdi mdi-file"></i> 
      <!--{else}--> 
      <i class="mdi mdi-file-cabinet"></i> 
      <!--{/if}--> 
      <span>$v[catname]</span></a>
    </li>
  <!--{/loop}-->
</ul>
<li class="dropdown-divider"></li>
<ul class="nav-drawer nav-stacked nav-pills">
  <li><span class="dropdown-item disabled">工具</span></li>
  <li class="nav-item">
    <a href="javascript:;" class="nav-link document-data" data-href="{MOD_URL}&op=share" data-hash="share&uid={$uid}"><i class="mdi mdi-share-variant"></i><span>{lang share}</span></a>
  </li>
  <li class="nav-item">
    <a href="javascript:;" class="nav-link document-data" data-href="{MOD_URL}&op=dynamic" data-hash="dynamic"><i class="mdi mdi-comment-multiple"></i><span>{lang dynamic}</span></a>
  </li>
  <li class="nav-item">
    <a href="javascript:;" class="nav-link document-data" data-href="{MOD_URL}&op=recycle" data-hash="recycle&uid={$uid}"><i class="mdi mdi-delete"></i><span>{lang explorer_recycle_name}</span></a>
  </li>
  <li class="nav-item">
    <a href="javascript:;" class="nav-link document-data" data-href="{MOD_URL}&op=collection" data-hash="collection"><i class="mdi mdi-star"></i><span>{lang collect}</span></a>
  </li>
  <!--{if $_G['adminid'] == 1}-->
  <li class="dropdown-divider"></li>
  <li><span class="dropdown-item disabled">{lang manage}</span></li>
  <li class="nav-item">
    <a href="javascript:;" class="nav-link document-data" data-href="{MOD_URL}&op=app" data-hash="app"><i class="mdi mdi-cog"></i><span>{lang function_management}</span></a>
  </li>
  <!--{if $explorer_setting['grouponperm']}-->
  <li class="nav-item">
    <a href="javascript:;" class="nav-link document-data" data-href="{MOD_URL}&op=groupmanage" data-hash="groupmanage"><i class="mdi mdi-account-cog"></i><span>{lang groups_management}</span></a>
  </li>
  <!--{/if}-->
  <!--{/if}--> 
</ul>
<div id="template_newGroupButton" style="display:none"> 
  <!--{if $explorer_setting['allownewgroup']}-->
  <button type="button" class="groupbutton dcolor" onclick="showWindow('newGroup','{MOD_URL}&op=ajax&operation=addgroup')"><span class="mdi mdi-plus-circle"></span></button>
  <!--{/if}--> 
</div>
<div id="template_newcloudButton" style="display:none"> 
  <!--{if $_G['adminid'] == 1}-->
  <a type="button" class="groupbutton dcolor" href="{ADMINSCRIPT}?mod=cloud&op=spaceadd" target="_blank"><span class="mdi mdi-plus-circle"></span></a>
  <!--{/if}--> 
</div>
<script type="text/javascript">
/*jstree 左侧个人、机构及群组*/
$(document).ready(function(e) {
  var bzhash = location.hash.replace('#', '');
  var bzpath = _explorer.getUrlParam(bzhash, 'path');
    _explorer.jstree=$('#position').jstree({
        "core": {
            "multiple": true,
            "check_callback": true,
            "themes": {
                "responsive": false
            },
            'data': function (node, cb) {
                var self = this;
                $.getJSON(MOD_URL+'&op=grouptree&do=get_children', {'id': node.id,'path':bzpath}, function (json) {
                    cb.call(this, json);
                });
            }
        },
        "types": {
            "#": {
                "max_children": -1,
                "max_depth": -1,
                "valid_children": -1
            },
            "organization": {//部门
                "icon": "mdi mdi-home-city",
                "valid_children": ['depart','folder']
            },
			      "department": {
                "icon": "dzz/system/images/department.png",
                "valid_children": ['depart','folder']
            },
			      "group": {//群组
                 "li_attr":'aaa',
                "icon": "mdi mdi-account-multiple",
                "valid_children": ['folder']
            },
            "cloud": {//云盘
                "icon": "mdi mdi-cloud",
                "valid_children": ['folder']
            },
			      "home": {//我的网盘
                "icon": "mdi mdi-account-box",
                "valid_children": ['folder']
            },
            "folder": {//群组
                "icon": "mdi mdi-folder",
                "valid_children": ['folder']
            },
        },
        "plugins": ['types', 'search','wholerow']
    });

    $('#position').off('select_node.jstree').on('select_node.jstree', function (e, data) {
        var inst = $('#position').jstree(true);
        var node = data.node;
        var hash = node.li_attr.hashs;
        var ohash=window.location.hash.replace('#','');
        if(ohash.replace(/&do=\w+/i,'')== hash){
        }else{
          location.hash=hash;
        }
        inst.open_node(node);
        return false;
    });
});
  $('#position').off('open_node.jstree').on('open_node.jstree', function (e, data) {
		 var node = data.node;
		if(node.id=='group') jQuery(jQuery('#template_newGroupButton').html()).appendTo('#group');
    if(node.id=='cloud') jQuery(jQuery('#template_newcloudButton').html()).appendTo('#cloud');
	});

    $("#position").off('ready.jstree').on('ready.jstree', function(e) {
         var inst = $("#position").jstree(true);
         var hash = location.hash;
         if(hash) {
            var hash = (hash.replace(/^#/,''));
             _explorer.jstree_select(hash);
        }else{
			location.hash='#recent';
		}
		//增加添加群组按钮
		jQuery(jQuery('#template_newGroupButton').html()).appendTo('#group');
    jQuery(jQuery('#template_newcloudButton').html()).appendTo('#cloud');
     });
</script> 